---
name: useObjectKnob
menu: Knobs
route: /use-object-knob
---

import { useState } from "react";
import { Playground } from "docz";
import { Inspector, useObjectKnob } from "../../src/lib";

### useObjectKnob(label, object)

Shows an object editor on the inspector. Returns the current value and also a method to set the value;

- `label` - A label for the color picker
- `value` - A color (string or hex value) as initial value

#### Usage

```javascript
import { useObjectKnob } from "retoggle";
```

<Playground>
{() => {
    const [obj, setObj] = useObjectKnob("Color", {});

    return (
        <React.Fragment>
            <Inspector usePortal={false} />
            {JSON.stringify(obj)}
        </React.Fragment>
    )

}}

</Playground>
